package com.codeforces.gym.g100184;

import java.util.Scanner;

public class L {

	static Scanner scanner = new Scanner(System.in);
	static int a, b, c, d, e, f, g, h, i;

	public static void main(String[] args) {
		a = scanner.nextInt();
		b = scanner.nextInt();
		c = scanner.nextInt();
		d = scanner.nextInt();
		e = scanner.nextInt();
		f = scanner.nextInt();
		g = scanner.nextInt();
		h = scanner.nextInt();
		i = scanner.nextInt();
		System.out.println(a*e*i + d*h*c + b*f*g - a*h*f - b*d*i - g*e*c);
	}

}
